﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using kmer.Web.Helper;
using com.kmer.ApiServer.Attributes;
using com.kmer.db;

namespace com.kmer.ApiServer {
	/// <summary>
	/// API测试Controller类
	/// </summary>
	public class TestHandler :BaseHandler{
		/// <summary>
		/// 接收一个参数然后加上“Hello”并返回
		/// </summary>
		/// <param name="Name"></param>
		/// <returns></returns>
		public object Hello(string Name = "NoName") {
          
			return this.Success("Hello " + Name);
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="id"></param>
		/// <returns></returns>
        public object Guid(Guid id ) {
            return this.Success("Hello " + id);
        }

        /// <summary>
        /// 接收一个JSON字串
        /// 不做任何处理直接返回
        /// </summary>
        /// <param name="data"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        [JSONData]
		public object JSON(string data, int type = 1) {
			var obj = QueryStringHelper.ParseQueryToJson(data);
			return this.Success(obj);
		}
	}
}
